﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TimeEntryFormControl.ascx.cs"
    Inherits="TeamTime.TimeEntryFormControl" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Src="LabelWithTimedMsg.ascx" TagName="LabelWithTimedMsg" TagPrefix="uc1" %>

<asp:TextBox ID="txtCompanyID" runat="server" Visible="false"></asp:TextBox>
<asp:CheckBox ID="chkSuccessfullySaved" runat="server" Visible="false"></asp:CheckBox>
<asp:Panel runat="server" ID="pnlDetails" SkinID="PopupPanel" DefaultButton="btnSave"
    Width="598px">
    <table cellspacing="0" width="595px" border="0">
        <tr id="trID" runat="server" visible="false">
            <td>
                ID
            </td>
            <td>
                <asp:TextBox ID="txtID" runat="server" ReadOnly="true" BackColor="#E0E0E0" BorderStyle="None"></asp:TextBox>&nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Task
            </td>
            <td>
                <asp:TextBox ID="txtTaskName" runat="server" CssClass="searchBox" Width="450"></asp:TextBox>
                &nbsp;&nbsp;&nbsp;&nbsp;
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" Display="Dynamic"
                    ErrorMessage="* Required" ValidationGroup="addform" ControlToValidate="txtTaskName"></asp:RequiredFieldValidator>
                    <br /><asp:Label ID="lblTaskValid" runat="server" ForeColor="Red"></asp:Label>
                <ajaxToolkit:AutoCompleteExtender runat="server" ID="AutoCompleteExtender2" TargetControlID="txtTaskName"
                    ServicePath="AutoComplete.asmx" ServiceMethod="getTasks" MinimumPrefixLength="0"
                    EnableCaching="true"  OnClientPopulating='show' OnClientPopulated='hide' SkinID="AutoCompleteExtender" />
            </td>
            <td>
                <asp:HyperLink ID="hypAddTask" runat="server" NavigateUrl="TasksForm.aspx?mode=add" Target="_blank">Add a task</asp:HyperLink>
            </td>

        </tr>
        <tr>
            <td>
                Start Date
            </td>
            <td>
                <clib:TextBoxCalendar ID="calStartDate" runat="server" ClearText="" DateFormat="yyyy/MM/dd"
                    ReadOnly="False" Required="True" ErrorMessage="* Required" Text="" Width="80px"
                    EnableViewState="true">
                </clib:TextBoxCalendar>
                &nbsp; Time&nbsp;
                <asp:TextBox ID="txtStartTime" runat="server" Width="58px" MaxLength="5" ReadOnly="true"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic"
                    ErrorMessage="* Required" ValidationGroup="addform" ControlToValidate="txtStartTime"></asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                End Date
            </td>
            <td>
                <clib:TextBoxCalendar ID="calEndDate" runat="server" ClearText="" DateFormat="yyyy/MM/dd"
                    ReadOnly="False" Required="False" Text="" Width="80px" EnableViewState="true">
                </clib:TextBoxCalendar>
                <asp:Label ID="lbldate" runat="server" Text=""></asp:Label>
                &nbsp; Time&nbsp;
                <asp:TextBox ID="txtEndTime" runat="server" Width="58px" MaxLength="5" ReadOnly="true"></asp:TextBox>
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Duration
            </td>
            <td>
                <asp:TextBox ID="txtDuration" runat="server" Width="27px" MaxLength="9" ReadOnly="true"
                    BorderStyle="None" BackColor="#E0E0E0"></asp:TextBox>
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Person
            </td>
            <td>
                <asp:DropDownList ID="ddlStaffMemberID" runat="server" Enabled="false">
                </asp:DropDownList>
            </td>
            <td>
                &nbsp;
            </td>
           
        </tr>
        <tr>
            <td>
                Description
            </td>
            <td>
                <asp:TextBox ID="txtTimeEntryDescription" runat="server" Width="470px" MaxLength="2000"
                    ReadOnly="true" Rows="6" TextMode="MultiLine"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic"
                    ErrorMessage="* Required" ValidationGroup="addform" ControlToValidate="txtTimeEntryDescription"></asp:RequiredFieldValidator>
            </td>
           
           
        </tr>
        <tr id="trSaveButton" runat="server">
            <td colspan="2" align="right">
                <uc1:LabelWithTimedMsg ID="lblSaveMessage" runat="server" />
                <asp:Button ID="btnSave" runat="server" Text="Save" ValidationGroup="addform" 
                    OnClick="btnSave_Click" Width="93px"  />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="btnCopy" runat="server" Text="Copy to New" ValidationGroup="addform"
                    onclientclick="JavaScript:CopyToNew();"  Visible="false" />
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr id="trModif" runat="server" visible="true">
            <td colspan="2">
                Modified By&nbsp;
                <asp:TextBox ID="txtUserNameModifiedBy" runat="server" Width="137px" MaxLength="4"
                    ReadOnly="true" BackColor="#E0E0E0" BorderStyle="None"></asp:TextBox>
                On
                <asp:TextBox ID="txtRecordDate" runat="server" Width="62px" MaxLength="10" ReadOnly="true"
                    BackColor="#E0E0E0" BorderStyle="None"></asp:TextBox>&nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
     <script type="text/javascript">
         function show(source, eventArgs) {

             source.get_element().className = 'searchBoxSearching';
         }
         function hide(source, eventArgs) {

             source.get_element().className = 'searchBox';
         }
		 function CopyToNew()
		 {
			document.getElementById('<%=txtID.ClientID%>').value = '';
			var et = document.getElementById('<%=txtEndTime.ClientID%>');
            if (et.value != '')
            {
                document.getElementById('<%=txtStartTime.ClientID%>').value = et.value;
                document.getElementById('<%=txtTimeEntryDescription.ClientID%>').value = '';
				document.getElementById('<%=txtDuration.ClientID%>').value = '';
            }
			et.value='';
		 }
        </script>
</asp:Panel>
